/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaceJogo;

import Instancia.Objetos;
import Time.Time;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;

/**
 *
 * @author Administrador
 */
public class JanelaTimes extends JFrame{
    private JComboBox<String> times;
    private JButton b;
    private int escolha;
    Time time;
    public JanelaTimes(){
        Container c = getContentPane();
        escolha=50;
        c.setBackground(Color.lightGray);
        Botao bt = new Botao();
        c.setLayout(new FlowLayout());
        b= new JButton("Ok");
        times = new JComboBox<>();
        
        times.addItem("Grêmio");
        times.addItem("Internacional");
        times.addItem("Cruzeiro");
        times.addItem("Botafogo");
        times.addItem("Flamengo");
        times.addItem("Fluminense");
        times.addItem("Santos");
        times.addItem("São Paulo");
        times.enable(true);
        b.addActionListener(bt);
        c.add(times);
        c.add(b);
        setTitle("Escolha um dos Times para Treinar");
        setSize(400,200);
        setVisible(true);
        
    }
    
        
       
    public int getEscolha(){
        return escolha;
    }
    /**
     * @return the times
     */
    public JComboBox<String> getTimes() {
        return times;
    }

    /**
     * @param times the times to set
     */
    public void setTimes(JComboBox<String> times) {
        this.setTimes(times);
    }

    public void setEscolha(int escolha) {
        this.escolha = escolha;
    }

    
    public class Botao implements ActionListener{

        @Override
        public void actionPerformed(ActionEvent e) {
            if (e.getSource()==b) {
                setEscolha(times.getSelectedIndex());
                setVisible(false);
            }
        }
        
    }
    
}
